//
//  HapticManager.swift
//  TomatoClock
//
//  Created by DaleGuo on 2023/11/11.
//

import Foundation
import UIKit

class HapticManager {
    static let instance = HapticManager()

    func impact(style: UIImpactFeedbackGenerator.FeedbackStyle) {
        let generator = UIImpactFeedbackGenerator(style: style)
        generator.impactOccurred()
    }

    func finish_tomato_clock() {
        impact(style: .light)
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
            self.impact(style: .light)
        }
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
            self.impact(style: .light)
        }
        DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {
            self.impact(style: .light)
        }
        
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            self.impact(style: .heavy)
        }
    }
}
